<?php
/* Clase del formulario FrmRoles que permite configurar los roles de usuarios
 */
class FrmRoles{
	private $setter;
	private $dbOperator;
	private $easyForm;
	private $frmTableRoles;
	private $divRolesTable;
	

	function FrmRoles(){
		$this->setter=new Setter("../../Config");
		$this->easyForm=new EasyForm("frmRoles","frmRoles","get", "../../Events/Admin/EventsFrmRoles.php","Crear rol de usuario:","", "", "");
		$this->easyForm->addInput(1,"Nombre:", "nombreRol", "nombreRol","", "", "", "", "form", "", "", array());
		$this->easyForm->addSimpleLabel(1, "Espacio0:", $id="espacio", $text="", $events=array());
		$this->easyForm->addSimpleLabel(1, "Espacio1:", $id="espacio", $text="", $events=array());
		$this->easyForm->addSimpleLabel(2, "Secciones:", $id="secciones", $text="Secciones disponibles:", $events=array());
		$this->easyForm->addSimpleLabel(1, "Espacio2:", $id="espacio", $text="&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;", $events=array());
		$this->easyForm->addSimpleLabel(1, "Espacio3:", $id="espacio", $text="&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;", $events=array());
		//Listar las secciones disponibles
		$checkBoxes="";
		foreach ($this->setter->getSections() as $section){
			$this->easyForm->addCheckBox(1,$section,$section,$section,"yes","","","","");
			$checkBoxes=$checkBoxes."'".$section."',";
		}
		$checkBoxesFixed=substr($checkBoxes,0,strlen($checkBoxes)-1);
		//--------------------------------
		
		$this->easyForm->addTextArea(1,"Descripcion:","25","1","descripcionRol","descripcionRol");
		
		$this->easyForm->addSimpleLabel(1, "Espacio3:", $id="espacio", $text="", $events=array());
		
		$this->easyForm->addButton(1,"CrearRol:","crearRol","crearRol","crearRol","crear","crear rol","button","","button","","","","","",array("onClick"=>"GETMethodSend(".$checkBoxesFixed.",'nombreRol','descripcionRol',this.id,'tableRoles','../../Events/Admin/EventsFrmRoles.php')"));
		
		$this->frmTableRoles=new FrmTableRoles();

		$this->divRolesTable=new Div("tableRoles","tableRoles","tableDB");
		
	}
	function show(){
		$this->easyForm->show(3,6);
		$this->divRolesTable->start();
			$this->frmTableRoles->show();
		$this->divRolesTable->end();
	}
}

?>